#include "Laser.h"
#include "ActivateAbility.h"

Laser::Laser(): activateAbility(0), blockMoveAbility(0)
{
	// Setup abilities
	activateAbility = new ActivateAbility(this);
	blockMoveAbility = new BlockMoveAbility();

	AddAbility(activateAbility);
	AddAbility(blockMoveAbility);

	// Setup behaviour
	behavior.SetActivator(this);
}

Laser::~Laser()
{
	if (activateAbility)
	{
		delete activateAbility;
		activateAbility = 0;
	}

	if (blockMoveAbility)
	{
		delete blockMoveAbility;
		blockMoveAbility = 0;
	}
}

void Laser::MoveTo(unsigned int cellX, unsigned int cellY)
{
	SetPosition(cellX, cellY);
}

void Laser::SetShootDirection(const Direction& direction)
{
	shootDirection = direction;
	behavior.SetShootDirection(direction);
	blockMoveAbility->SetBlockDirection(direction.Opposed());
}

void Laser::Activate()
{
	printf("Laser activated\n");
}

StepCalculator* Laser::GetActivationBehavior()
{
	return &behavior;
}
